/**
 * 
 */
package com.sign.signsystem;

import com.biz.service.UserService;

import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

/**
 * @author Bosto
 *
 */
public class UserSecurityActivity extends HandlerActivity{
	EditText pwET,newPwET,newPwcET;
	Button confirmBtn;
	int ok = 8;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.user_security);

		pwET = (EditText) findViewById(R.id.old_pw_edittext);
		newPwET = (EditText) findViewById(R.id.new_pw_edittext);
		newPwcET = (EditText) findViewById(R.id.new_pw_confirm_edittext);
		confirmBtn = (Button) findViewById(R.id.new_pw_submit_btn);
		confirmBtn.setOnClickListener(this);
	}

	/* (non-Javadoc)
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View v) {
		new Thread(new Runnable(){
			@Override
			public void run() {
				Message message = new Message();	
				if (new UserService().updateUserPassword()) {
					message.what = 8;
					mHandler.sendMessage(message);
				} else {
					message.what = 2;
					mHandler.sendMessage(message);
				}
			}	
		}).start();
	}

	/* (non-Javadoc)
	 * @see com.sign.signsystem.HandlerActivity#hanldeMessage(android.os.Message)
	 */
	@Override
	void hanldeMessage(Message msg) {
		if (msg.what==8) {
			showLongMessage("修改密码成功！");
		} else{
			showLongMessage("修改棉麻失败");
		}
	}

}
